﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GameSchool.Repository;

namespace GameSchool.Controllers
{
	/// <summary>
	/// CommentController sér um alla virkni í sambandi við comment, like og 
	/// dislike kerfisins. 
	/// </summary> 

	//[HandleError]
//	[Authorize]
	public class CommentController : Controller
    {
        IGameSchoolRepository m_data = RepositoryMaster.CurrentRepository;

        private Models.Person CurrentPerson
        {
            get
            {
                if (User.Identity.IsAuthenticated)
                {
                    return m_data.Persons.Where(x => x.Username == User.Identity.Name).First();
                }
                return null;
            }
        }
        
        // GET: /Comment/
        public ActionResult Index()
        {
            return View();
        }

        // GET: /Comment/Details/5
        public ActionResult Details(int id)
        {
            return View();
        }

        // GET: /Comment/Create
        public ActionResult CreateComment()
        {
            return View();
        } 

        // POST: /Comment/Create
        [HttpPost]
        public ActionResult CreateComment(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        // GET: /Comment/Edit/5
        public ActionResult EditComment(int id)
        {
            return View();
        }

        // POST: /Comment/Edit/5
        [HttpPost]
        public ActionResult EditComment(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        // GET: /Comment/Delete/5 
        public ActionResult DeleteComment(int id)
        {
            return View();
        }

        // POST: /Comment/Delete/5
        [HttpPost]
        public ActionResult DeleteComment(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    
	    // GET: /Comment/Like
        public ActionResult LikeComment(int id)
        {
            return View();
        }

        // POST: /Comment/Like/5
		[HttpPost]
		public ActionResult LikeComment(int id, FormCollection collection)
		{
			try
			{
				// TODO: Add like logic here

				return RedirectToAction("Index");
			}
			catch
			{
				return View();
			}
		}

		// GET: /Comment/Dislike/5
        public ActionResult DislikeComment(int id)
        {
            return View();
        }

        // POST: /Comment/Dislike/5
		[HttpPost]
		public ActionResult DislikeComment(int id, FormCollection collection)
		{
			try
			{
				// TODO: Add dislike logic here

				return RedirectToAction("Index");
			}
			catch
			{
				return View();
			}
		}	
	}
}
